package br.com.pd.invocation;

import br.com.util.PropertiesLoader;

public class SupplyListener {
	private String ip;
	private int port;
	private long timeOut;
	private long criationTime;
	
	public SupplyListener(String ip, int port){
		this.criationTime = System.currentTimeMillis();
		this.timeOut = Integer.parseInt(PropertiesLoader.getInstance().getPropertie(PropertiesLoader.TIME_OUT_SUPPLY_LISTENER));
		this.ip = ip;
		this.port = port;
	}
	
	
	
	public String getIp() {
		return ip;
	}



	public void setIp(String ip) {
		this.ip = ip;
	}



	public int getPort() {
		return port;
	}



	public void setPort(int port) {
		this.port = port;
	}



	public boolean isExprire(){
		long now = System.currentTimeMillis();
		return (now - this.criationTime) >= timeOut;
	}



	@Override
	public String toString() {
		return "ip " + getIp()+ " port " + getPort()+ " timeout " + this.timeOut;
	}
	
	
}
